<?php
/*
 * @Author: your name
 * @Date: 2020-06-29 09:28:29
 * @LastEditTime: 2020-07-09 14:48:12
 * @LastEditors: 天羽落星辰
 * @Description: In User Settings Edit
 * @FilePath: \WWW\frx\application\api\controller\Index.php
 */ 

namespace app\api\controller;

use think\Loader;
use app\common\controller\Api;
use app\admin\model\Feedback as fbk;


/**
 * 反馈意见
 */
class Feedback extends Api
{
    protected $noNeedLogin = ['*'];
    protected $noNeedRight = ['*'];

    /**
     * 反馈提交
     * @param string $email      邮箱
     * @param string $content    内容
     */ 
    public function add()
    {
        $email = $this->request->request('email');
        $content = $this->request->request('content');
        $data['email'] = $email;
        $data['content'] = $content;
        $data['uid'] = $this->auth->id;
        $data['uname'] = $this->auth->username;

        $validate = Loader::validate('admin/Feedback');
        if(!$validate->scene('add')->check($data)){
            $this->error($validate->getError());
        }
        
        $ret = fbk::create($data);
        if($ret->id){
            $this->success('提交成功');
        }

        $this->error('提交失败');

    }
   
   
}
